<?php
class AgendasSegment extends AppModel {
	var $name = 'AgendasSegment';
	//The Associations below have been created with all possible keys, those that are not needed can be removed
/*
	var $belongsTo = array(
		'Agenda' => array(
			'className' => 'Agenda',
			'foreignKey' => 'agenda_id',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		),
		'Segment' => array(
			'className' => 'Segment',
			'foreignKey' => 'segment_id',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		)
	);
*/	
	
	var $hasMany = array(
		'Segment' => array(
			'className' => 'Segment',
			'foreignKey' => 'id',

		)
	);	
	
        /*
         * Obtienes los segmentos de una Agenda
         * @param int $agendaId
         * return arr
         */
        function getAgendasSegments($agendaId = 0){
            $arrSegmentos = $this->query(" SELECT AgendasSegment.segment_id
				FROM agendas_segments AS AgendasSegment 
                                WHERE id = '$agendaId' " );
            
            return $arrSegmentos;

        }
        
        
}
?>